<extend name="base"/>

<block name="extend">
<script language="javascript">$(document).ready(product_obj.product_add);</script> 
<script type="text/javascript">var id = "{$productinfo.id}";</script>
</block>

<block name="editor_block">
	
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Member/js/plugin/ckfinder/ckfinder.js"></script>
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Member/api/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/Member/api/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/Member/api/ueditor/lang/zh-cn/zh-cn.js"></script>
	<script>	
	var ue = UE.getEditor('editor');
	</script>
</block>


<block name="body">

<div id="news" class="r_con_wrap">
	<form id="product_form" class="r_con_form">
	   <div class="rows">
	        <label>商品名称</label>
	        <span class="input"><input type="text" name="name" value="{$productinfo.name}" class="form_input" size="35" maxlength="100" notnull /> <font class="fc_red">*</font></span>
	        <div class="clear"></div>
	    </div> 
	     
	    <div class="rows">
            <label>市场价</label>
            <span class="input"><input type="text" name="oriprice" value="{$productinfo.oriprice}" class="form_input" size="35" maxlength="100" notnull />&nbsp;元&nbsp;&nbsp;<font class="fc_red">*</font></span>
            <div class="clear"></div>
        </div>
        	<div class="rows">
				<label>成团内容设置</label>
				<span class="input">
					<div class="tips">填写你要收集的内容，预约默认选项不可以修改删除！</div>
					<table border="0" cellpadding="5" cellspacing="0" class="reverve_field_table" id="chengtuan_table">
						<thead>
							<tr>
								<td width="16%">成团类型</td>
								<td width="16%">成团人数</td>
								<td width="16%">成团价格(元)</td>
								<td width="20%">操作</td>
							</tr>
						</thead>
						<tbody id="chengtuan"> 								
							<tr style="display:;" fieldtype="text" mid="1">
								<td>成团类型1：</td>
								<td><span class="notime"><input type="text" class="form_input" size="55" value="{$productgrouparr[0]['groupnumber']}" name="chengtuan[]"></span></td>
								<td><span class="notime"><input type="text" class="form_input" size="55" value="{$productgrouparr[0]['price']}" name="chengtuanprice[]"></span></td>
								<td>
		                        	<a href="javascript:void(0);" class="input_add2"><img src="__PUBLIC__/Member/images/ico/add.gif"></a>
		                        </td>
							</tr>
							
							<foreach name="productgrouparr" item="vo" key="k">
								<if condition ="$k gt 0">
									<tr style="display:;" fieldtype="text" mid="{$k+1}">
										<td>成团类型{$k+1}：</td>
										<td><span class="notime"><input type="text" class="form_input"  size="55" value="{$vo.groupnumber}" name="chengtuan[]"></span></td>											
										<td><span class="notime"><input type="text" class="form_input"  size="55" value="{$vo.price}" name="chengtuanprice[]"></span></td>
										<td>
				                            <a href="javascript:void(0);" class="input_del2"><img src="__PUBLIC__/Member/images/ico/del.gif"></a>		                                    
				                        </td>
									</tr>
								</if>
							</foreach>
						</tbody>
					</table>
				</span>
				<div class="clear"></div>
			</div>
	    <div class="rows">
					<label>封面图</label>
					<span class="input">
						<span class="upload_file">
							<div>
								<div class="up_input">
								    <input name="ImgUpload" id="ImgUpload" type="file" width="120" height="30" style="display: none;">
								</div>
								<input type="hidden" name="ImgPath" value="{$productinfo.coverimg}">
								<div class="tips">图片宽度建议：280x200px</div><br/>
								<div class="clear"></div>
							</div>
							<div class="img" id="ImgDetail">
								<if condition = "$productinfo['coverimg'] neq null">
					                <a href="{$productinfo.coverimg}" target="_blank">
					                    <img src="{$productinfo.coverimg}">
					                </a>
					            </if> 
							</div>
						</span>
					</span>
					<div class="clear"></div>
				</div>
	    <div class="rows" id="products">
            <label>轮播展示图</label>
            <span class="input">
                <span class="upload_file">
                    <div>
                        <div class="up_input"><input name="PicUpload" id="PicUpload" type="file" /></div>
                        <div class="tips">共可上传<span id="pic_count">5</span>张图片，图片大小建议：640*320像素</div>
                        <div class="clear"></div>
                    </div>
                </span>
                <div class="img" id="PicDetail">   
                    <foreach name="productinfo.imgpath" item="vv">
                        <div>
                        <a href="{$vv}" target="_blank">
                            <img src="{$vv}"></a>
                            <span>删除</span>
                            <input type="hidden" name="PicPath[]" value="{$vv}">
                        </div>
                    </foreach> 
                </div>
            </span>
            <div class="clear"></div>
        </div>
		 <div class="rows">
	        <label>商品详情</label>
	        <span class="input"><textarea id="editor"  class="myEditor" name="description" >{$productinfo.description}</textarea></span>
	        <div class="clear"></div>
	    </div> 
       <div class="rows">
	        <label>右侧备注</label>
	        <span class="input"><input type="text" name="remark" value="{$productinfo.remark}" class="form_input" size="35" maxlength="100" notnull /> <span class="tips">字数不得多于10个</span><font class="fc_red">*</font></span>
	        <div class="clear"></div>
	    </div>
	    <div class="rows">
	        <label>规格</label>
	        <span class="input"><input type="text" name="spec" value="{$productinfo.spec}" class="form_input" size="35" maxlength="100" notnull /> <span class="tips">例：口味、类型等</span> <font class="fc_red">*</font></span>
	        <div class="clear"></div>
	    </div>
	    
	    	<div class="rows">
				<label>规格内容设置</label>
				<span class="input">
					<div class="tips">填写你要收集的内容，预约默认选项不可以修改删除！</div>
					<table border="0" cellpadding="5" cellspacing="0" class="reverve_field_table" id="guige_table">
						<thead>
							<tr>
								<td width="16%">规格</td>
								<td width="32%">字段内容</td>
								<td width="16%">总量(个)</td>
								<if condition="$productinfo.id neq null"><td width="16%">库存(个)</td></if>
								<td width="20%">操作</td>
							</tr>
						</thead>
						<tbody id="guige"> 								
							<tr style="display:;" fieldtype="text" mid="1">
								<td>规格1：</td>
								<td><span class="notime"><input type="text" class="form_input" size="55" value="{$productspecarr[0]['spectype']}" name="guige[]"></span></td>
								<td><span class="notime"><input type="text" class="form_input" size="55" value="{$productspecarr[0]['totalnumber']}" name="total[]"></span></td>
								<if condition="$productinfo.id neq null"><td><span class="notime"><input type="text" class="form_input" size="55" value="{$productspecarr[0]['restnumber']}" name="rest[]"></span></td></if>
								<td>
		                        	<a href="javascript:void(0);" class="input_add"><img src="__PUBLIC__/Member/images/ico/add.gif"></a>
		                        </td>
							</tr>
							
							<foreach name="productspecarr" item="vo" key="k">
								<if condition ="$k gt 0">
									<tr style="display:;" fieldtype="text" mid="{$k+1}">
										<td>规格{$k+1}：</td>
										<td><span class="notime"><input type="text" class="form_input"  size="55" value="{$vo.spectype}" name="guige[]"></span></td>
										<td><span class="notime"><input type="text" class="form_input"  size="55" value="{$vo.totalnumber}" name="total[]"></span></td>
										<td><span class="notime"><input type="text" class="form_input"  size="55" value="{$vo.restnumber}" name="rest[]"></span></td>
																					
										<td>
				                            <a href="javascript:void(0);" class="input_del"><img src="__PUBLIC__/Member/images/ico/del.gif"></a>		                                    
				                        </td>
									</tr>
								</if>
							</foreach>
							 
						</tbody>
					</table>
				</span>
				<div class="clear"></div>
			</div>
	    	
        <div class="rows">
	        <label></label>
	        <span class="input"><input type="button" class="btn_green" name="submit_button" value="提交保存" /><a href="{:U('list_product')}" class="btn_gray">返回</a></span>
	        <div class="clear"></div>
	    </div>
	    <input type="hidden" name="id" value="{$id}">
	    <input type="hidden" name="ispublic" value="{$productinfo.ispublish}">
	</form>
</div>  
</block>